Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safe Area #559

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Safe Area #559

wants to merge 17 commits into from

Conversation

qeeqez
Copy link
Contributor

@qeeqez qeeqez commented Nov 22, 2024

TMA V8: Safe Area

Implemented Safe Area scope

Signals

  • inset: SafeAreaInset
  • contentInset: SafeAreaInset
  • state: State

Types

type SafeAreaInset = { 
  top: number, 
  bottom: number, 
  left: number, 
  right: number 
};

interface State {
  inset: SafeAreaInset;
  contentInset: SafeAreaInset;
}

BindCssVars

if (bindCssVars.isAvailable()) {
  bindCssVars();
}

// --tg-safe-area-inset-top: 0px;
// --tg-safe-area-inset-bottom: 30px;
// --tg-safe-area-inset-left: 40px;
// --tg-safe-area-inset-right: 40px;

// --tg-content-safe-area-inset-top: 40px;
// --tg-content-safe-area-inset-bottom: 0px;
// --tg-content-safe-area-inset-left: 0px;
// --tg-content-safe-area-inset-right: 0px;

Custom BindCssVars

if (bindCssVars.isAvailable()) {
  bindCssVars((component, property) => `--my-prefix-${component}-${property}`);
}

// --my-prefix-safeArea-top: 0px;
// --my-prefix-safeArea-bottom: 30px;
// --my-prefix-safeArea-bottom: 40px;
// --my-prefix-safeArea-right: 40px;
 
// --my-prefix-contentSafeArea-top: 40px;
// --my-prefix-contentSafeArea-bottom: 0px;
// --my-prefix-contentSafeArea-left: 0px;
// --my-prefix-contentSafeArea-right: 0px;

Copy link

changeset-bot bot commented Nov 22, 2024

🦋 Changeset detected

Latest commit: 0f1ebe3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@telegram-apps/bridge Minor
@telegram-apps/sdk Minor
@telegram-apps/navigation Patch
@telegram-apps/sdk-react Patch
@telegram-apps/sdk-solid Patch
@telegram-apps/sdk-svelte Patch
@telegram-apps/sdk-vue Patch
svelte-template Patch
vue-template Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Nov 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 23, 2024 1:46am

@qeeqez
Copy link
Contributor Author

qeeqez commented Nov 22, 2024

@singerxt check CSS vars pls, I've checked only exported signals and state with it.

UPD: CSS binding fixed and tested, works as expected now

@singerxt
Copy link

This looks great!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants